package org.lzy.shop.activity


import android.text.TextUtils

import org.lzy.shop.R
import org.lzy.shop.base.BaseMvvmActivity
import org.lzy.shop.databinding.ActivityForgetpwdBinding
import org.lzy.shop.viewmodel.LoginViewModel

/**
 * 忘记密码(未做)
 */
class ForgetPwdActivity: BaseMvvmActivity<ActivityForgetpwdBinding, LoginViewModel>({ ActivityForgetpwdBinding.inflate(it) }) {


    override fun initView() {
        setTitleText(getResString(R.string.forget_pwd))

    }

    override fun initData() {

    }

    override fun requestData() {
    }



    override fun allClick() {
        binding.updatePwd.setOnClickListener {
            val mobile = binding.actEditLoginPwdEtTel.text.toString().trim()  //手机
            val old = binding.actEditLoginPwdEtSecurityCode.text.toString().trim() //旧密码
            val psw1 = binding.actEditLoginPwdEtPswOne.text.toString().trim()  //新密码
            val psw2 = binding.actEditLoginPwdEtPswTwo.text.toString().trim()  //确认新密码

            if (TextUtils.isEmpty(mobile)) {
                showToast(getResString(R.string.input_mobile))
                return@setOnClickListener
            }
            if (TextUtils.isEmpty(old)) {
                showToast(getResString(R.string.input_code))
                return@setOnClickListener
            }
            if (TextUtils.isEmpty(psw1)) {
                showToast(getResString(R.string.Please_enter_new_password))
                return@setOnClickListener
            }
            if (TextUtils.isEmpty(psw2)) {
                showToast(getResString(R.string.password_nomatch))
                return@setOnClickListener
            }

            if (psw1 != psw2) {
                showToast(getResString(R.string.password_nomatch))
                return@setOnClickListener
            }
            //接口暂时没写


        }

    }


}